import java.util.Scanner;
import java.util.function.IntToDoubleFunction;

public class Tets7 {
    public static void main(String[] args) {
        int n=0;
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        int ret=fun1(n);
        System.out.println(ret);
      fun2(n);
    }
    public static int fun1(int n){
        if(n<10)
            return n;
        else
            return fun1(n/10)+n%10;
    }
    public static void fun2(int n){
        if(n>9)
            fun2(n/10);
        System.out.printf("%d ",n%10);

    }
}
